home *** CD-ROM | disk | FTP | other *** search
- /*
- File: USBEnet.h
-
- Contains: xxx put contents here xxx
-
- Version: xxx put version here xxx
-
- Copyright: © 1998-2000 by Apple Computer, Inc., all rights reserved.
-
- File Ownership:
-
- DRI: xxx put dri here xxx
-
- Other Contact: xxx put other contact here xxx
-
- Technology: xxx put technology here xxx
-
- */
-
- #ifndef _USBENET_
- #define _USBENET_
-
- #include <USB.h>
-
- #include "EnetShim.h"
-
- // Debug stuff
-
- #define DebugOn 0 // This is the master switch (On > 0)
- #define LogOn 0 // On > 0 (DebugOn must also be on)
- #define LogBug 0 // On > 0 (DebugOn and LogOn (to log data) must also be on) - dumps to the debugger
- #define FullTrace 0 // On > 0 Be careful with this as it traces everything (DebugOn must also be on)
-
- #if (DebugOn > 0)
- #define SLevel 4 // Status level for USB Expert Log
- #else
- #define SLevel 5 // Status level for USB Expert Log
- #endif
-
- #if (DebugOn > 0)
- #define DebugMessage(s) DebugStr(s)
- #else
- #define DebugMessage(s)
- #endif
-
- #if (DebugOn > 0)
- #define Bugon " - Debug"
- #else
- #define Bugon
- #endif
-
- #if ((DebugOn > 0) && (LogOn > 0))
- #define LogData(x, y, z) USBLogData(x, y, z)
- #else
- #define LogData(x, y, z)
- #endif
-
- #if (DebugOn > 0)
- #if (LogBug > 0)
- #define TraceMessage(x, s) {if (FullTrace > 0) DebugStr(s); else if (x) DebugStr(s);}
- #else
- #define TraceMessage(x, s) {if (FullTrace > 0) USBStatus(SLevel, 0, s, 0); else if (x) USBStatus(SLevel, 0, s, 0);}
- #endif
- #else
- #define TraceMessage(x, s)
- #endif
-
- #if (DebugOn > 0)
- #if (LogBug > 0)
- #define StatusMessage(a, s, c) DebugStr(s)
- #else
- #define StatusMessage(a, s, c) USBStatus(SLevel, a, s, c)
- #endif
- #else
- #define StatusMessage(a, s, c) USBStatus(SLevel, a, s, c)
- #endif
-
-
- #if (DebugOn > 0)
- #define noteError(s) gEnetGlobals.errorString = s;
- #else
- #define noteError(s)
- #endif
-
- // Change these for other devices etc.
-
- #define kUSBVendorID 0 // None
- #define kUSBProductID 0 // None
-
- #define kUSBRegName "\pUSB Ethernet External" // Name registry name
- #define kDrvName "\pUSB Enet " // Driver name - will be made unique by the shim if it is not
-
- // Miscellaneous
-
- enum
- {
- kBufferSize = 1514,
- kBufferPadSize = 24*64, // multiple of 64 (1536)
- kNumOutBufs = 3,
- kNumInBufs = 3,
- kAvailable = 0,
- kUnavailable = -1
- };
-
- typedef struct Buffers
- {
- struct QElem *qLink;
- UInt16 avail;
- UInt32 indx;
- USBPB bufPB;
- UInt8 Buffer[kBufferPadSize];
-
- } Buffers;
-
- typedef struct Buffers *BuffersPtr;
-
- // Global data structure
-
- typedef struct ShimEnetGlobals
- {
- // input buffer(s)
- Buffers inBuf[kNumInBufs]; // not really a good way to do this but what the hey (for now)
- ProcPtr isr; // To notify receiver
- UInt32 cookie; // With this parameter
- QHdr rcvq; // Receive queue
-
- // output buffer(s)
- Buffers outBuf[kNumOutBufs]; // not really a good way to do this but what the hey (for now)
-
- // miscellaneous
-
- ShimRefNum ShimRef; // save the shim's reference number
- Boolean openSession; // only allow one open session
- CFragConnectionID ConnID; // connection to the shim
- RegEntryID theID; // our reg. ID
- unsigned char rname[20]; // real driver name
-
- // Install and remove CFM routines
-
- OSErr (*ShimInstall) (EnetShimInterface IntBlk, ShimRefNum *ref);
- OSErr (*ShimRemove) (ShimRefNum ref, Boolean forced);
- OSErr (*ShimAsync) (ShimRefNum ref, UInt16 DvrSelector, UInt32 Value1, UInt32 Value2);
-
- } ShimEnetGlobals;
-
- extern ShimEnetGlobals *gGlobals;
-
- #endif